<template>
  <el-form ref="formRef" :model="orderForm" label-width="80px" inline>
    <el-form-item label="订单号">
      <el-input
        v-model="orderForm.order_code "
        :disabled="!edit"
        placeholder="请输入订单号"
        size="small"
      />
    </el-form-item>
    <el-form-item label="供应商">
      <el-select v-model="orderForm.vendor" :disabled="!edit" placeholder="请选择供应商" size="small">
        <el-option
          v-for="(item, index) in $store.state.basic_data.suppliers"
          :key="index"
          :label="item.name"
          :value="item.id"
        />
      </el-select>
    </el-form-item>
    <el-form-item label="订单日期">
      <el-date-picker
        v-model="orderForm.order_date"
        type="date"
        placeholder="选择日期"
        format="yyyy-MM-dd"
        value-format="yyyy-MM-dd"
        size="small"
        :disabled="!edit"
      />
    </el-form-item>
    <el-form-item label="订单状态">
      <el-select
        v-model="orderForm.order_status"
        :disabled=" orderForm.origin_status === 4"
        placeholder="请选择订单状态"
        size="small"
      >
        <el-option v-for="item in $store.state.basic_data.ORDER_STATUS" :label="item.name" :value="item.id" />
      </el-select>
    </el-form-item>
  </el-form>
</template>

<script>

export default {
  props: {
    // eslint-disable-next-line vue/require-default-prop
    orderForm: {
      type: Object,
      default: () => ({
        order_code: '',
        vendor: '',
        order_date: '',
        order_status: '',
        origin_status: ''
      })
    },
    edit: {
      type: Boolean,
      default: true
    }
  },
  data() {
    return {
      flag: 0
    }
  },
  created() {
    this.flag = this.orderForm.order_status
  },
  methods: {}
}
</script>
